package com.zhongli.devplatform.service.impl.live;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongli.devplatform.dto.ErrorRateDto;
import com.zhongli.devplatform.mapper.live.ReadWatchHistoryMapper;
import com.zhongli.devplatform.po.live.ReadWatchHistoryPO;
import com.zhongli.devplatform.service.imp.live.ReadWatchHistoryService;
import com.zhongli.devplatform.vo.sys.ReadVideoWatchVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 用户观看视频记录(ReadWatchHistory)表服务实现类
 *
 * @author aiyuan
 * @since 2020-08-04 16:42:10
 */
@Service
public class ReadWatchHistoryServiceImpl extends ServiceImpl<ReadWatchHistoryMapper, ReadWatchHistoryPO> implements ReadWatchHistoryService {

    @Resource
    private ReadWatchHistoryMapper readWatchHistoryMapper;

    @Override
    public List<ReadVideoWatchVO> studyReportOfWatchCount(ErrorRateDto errorRateDto) {
        /*String groupByType = errorRateDto.getGroupByType();
        switch (groupByType) {
            case "每月":
                errorRateDto.setGroupByType("%Y-%m");
                break;
            case "每年":
                errorRateDto.setGroupByType("%Y");
                break;
            case "每周":
                errorRateDto.setGroupByType("%Y-%u");
                break;
            case "每天":
                errorRateDto.setGroupByType("%Y-%m-%d");
                break;
        }*/
        return readWatchHistoryMapper.studyReportOfWatchCount(errorRateDto);
    }
}
